package com.hsh.maoduo.constant.common;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.format.FastDateFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author hsh
 * @DateTime 2023/10/27 16:06
 **/
public class DateConstants extends DatePattern {


    public final static FastDateFormat NORM_DATETIME_PATH_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd-HH-mm-ss");

    public static Date dateTimeParse(String str) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        try {
            date = sdf.parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    return date;
    }

    public static void main(String[] args) {
        String dateTime = "2019-01-01 01:01:01";
        Date date = DateConstants.dateTimeParse(dateTime);
        System.out.println(date);
    }
}
